package com.qdlc.p2p.biz.tpp.model;

import java.io.IOException;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.qdlc.p2p.common.constant.SinaConstant;
import com.qdlc.p2p.common.util.DateUtil;
import com.qdlc.p2p.dal.common.SystemConfigHelper;
import com.qdlc.p2p.dal.common.SystemConfigHelper.Nid;

/**
 * 新浪支付-查询存钱罐基金收益率
 * 
 * @author ylx
 * @version 2.0
 * @date 2015年8月11日 下午2:47:02
 */
public class SinaQueryFundYield extends SinaModel {
	
	/**
	 * 服务名称
	 */
	private String service;
	
	/**
	 * 基金代码
	 */
	private String fund_code;
	
	/**
	 * 提交地址
	 */
	private String member_url;
	
	/**
	 * 待签名字符数组
	 */
	private String[] signParamNames=new String[]{"version","service","request_time","partner_id","_input_charset","fund_code"};
	
	/**
	 * 提交字符数组
	 */
	private String[] subParamNames=new String[]{"version","service","request_time","partner_id","_input_charset","sign","sign_type","fund_code"};
	
	/******** 响应信息 start ********/
	
	/**
	 * 最近30日收益率及净值
	 */
	private String yield_list;
	
	/******** 响应信息 end ********/
	
	/**
	 * 获取服务名称
	 */
	public String getService() {
		return service;
	}

	public SinaQueryFundYield() {
		super();
	}
	
	public SinaQueryFundYield(String fund_code) {
		super();
		this.fund_code = fund_code;
		this.service = "query_fund_yield";
		this.member_url = SystemConfigHelper.getValue(Nid.RETURN_URL);
		this.setEncode(SinaConstant.ENCODE_TRUE);
		this.setRequest_time(DateUtil.dateStr3(DateUtil.getNow()));
	}

	@Override
	public SinaModel response(String res) throws IOException {
		try {
			JSONObject json = JSON.parseObject(res);
			yield_list = json.getString("yield_list");
		} catch (Exception e) {
			e.printStackTrace();
		}

		return null;

	}
	
	/**
	 * 设置服务名称
	 */
	public void setService(String service) {
		this.service = service;
	}

	/**
	 * 获取待签名字符数组
	 */
	public String[] getSignParamNames() {
		return signParamNames;
	}

	/**
	 * 设置待签名字符数组
	 */
	public void setSignParamNames(String[] signParamNames) {
		this.signParamNames = signParamNames;
	}

	/**
	 * 获取提交字符数组
	 */
	public String[] getSubParamNames() {
		return subParamNames;
	}

	/**
	 * 设置提交字符数组
	 */
	public void setSubParamNames(String[] subParamNames) {
		this.subParamNames = subParamNames;
	}

	public String getFund_code() {
		return fund_code;
	}

	public void setFund_code(String fund_code) {
		this.fund_code = fund_code;
	}

	public String getYield_list() {
		return yield_list;
	}

	public void setYield_list(String yield_list) {
		this.yield_list = yield_list;
	}

	public String getMember_url() {
		return member_url;
	}

	public void setMember_url(String member_url) {
		this.member_url = member_url;
	}
}
